<?php

namespace common\models;

use Yii;
use common\models\BaseRegionModel;
use common\models\HouseModel;
/**
 * This is the model class for table "{{%region_banner}}".
 *
 * @property int $id
 */
class BannerModel extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%region_banner}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['region', 'houseid'], 'integer'],
            [['banner'], 'string', 'max' => 100]
        ];
    }
	
	public function getBaseRegion(){
		return $this->hasOne(BaseRegionModel::className(), ['id' => 'region']);
	}
	
	public function getHouse(){
		return $this->hasOne(HouseModel::className(), ['id' => 'houseid']);
	}
	
    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'region' => '区域编号',
            'houseid' => '对应楼盘',
            'banner' => '广告图片路径'          
        ];
    }
}
